package cn.iocoder.yudao.module.resource.dal.mysql.download;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.resource.dal.dataobject.download.ResourceDownloadDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 下载记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ResourceDownloadMapper extends BaseMapperX<ResourceDownloadDO> {

    default List<ResourceDownloadDO> selectListByUserId(Long userId) {
        return selectList(ResourceDownloadDO::getUserId, userId);
    }

    default ResourceDownloadDO selectByUserIdAndMaterialId(Long userId, Long materialId) {
        return selectOne(ResourceDownloadDO::getUserId, userId,
                ResourceDownloadDO::getMaterialId, materialId);
    }

}
